package servlets.cardapio;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import br.Cardapio;
import br.Categoria;
import facade.RestauranteFacade;

/**
 * Servlet implementation class ExcluirCategoriaServlet
 */
@WebServlet("/excluirCardapio")
public class ExcluirCardapioServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		String idCardapio =  request.getParameter("idCardapio");
		
		Cardapio cardapio = new Cardapio();
		cardapio.setId(new Long(idCardapio));
		
		
		try {
			RestauranteFacade.removerCardapio(cardapio);
		} catch (SQLException e) {
			
		}
		
		response.sendRedirect("listarCardapios");
		
	}
		

}
